package jjn.acwing.algorithm_basic.chapter1.binary;

import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023-09-23 10:19
 */
public class Acwing801 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; i++) {
            System.out.print(bitCount(nums[i]) + " ");
        }
        System.out.println();
    }
    
    static int bitCount(int i) {
        int digit = 0;
        while (i > 0) {
            if ((i & 1) > 0) {
                digit++;
            }
            i = i >> 1;
        }
        return digit;
    }
}
